<?php
class index extends SClass {

public function process() {
  $user = $this->getUserSecure();
        if ($user) {
            if ($user->getLevel() >= 2) {
        	   $this->assign('autorized', 1);
            }
        }
        $post = ServiceUtils::GetFactory()->getNewsService()->getNewsAll();
        $a = array();
         $i=0;
        while ($x = $post->getNext()) {
            if ($i>5){break;}
            $i++;
            $a[] = array(
                'id' => $x->getId(),
                'title' => $x->getTitle(),
                'preview' => $x->getPreview(),
                'postdate' => $x->getPostdate(),
                'url' => Engine_LinkMaker::GetURLByContentID(
                    'news_post_view', $x->getId()),
                'urledit' => Engine_LinkMaker::GetURLByContentID(
                    'news_post_edit', $x->getId()),
                'urldelete' => Engine_LinkMaker::GetURLByContentID(
                    'news_post_delete', $x->getId())
            );
        }
        $this->assign('postArray', $a);
      
    }
     
}
